<?php /* Smarty version 2.6.18, created on 2010-03-16 09:23:47
         compiled from vieworders.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'count', 'vieworders.tpl', 80, false),array('modifier', 'number_format', 'vieworders.tpl', 119, false),array('function', 'cycle', 'vieworders.tpl', 115, false),)), $this); ?>
<div id="blanket" style="display:none;"></div>
<div id="payment" style="position:absolute;background-color:#fff;width:500px;z-index: 1002;display:none;">
</div>
<script>	
	var dd = new ekimo_drag_region("content","payment");
</script>
<div id="savetoexcel" style="position:absolute;background-color:#fff;width:400px;z-index: 1002;display:none;">
</div>
<form name="mainForm" method="POST" id="mainForm">
<?php if (! $this->_tpl_vars['search']): ?>
	<style type="text/css"> 
		<?php echo '
			#f_div { display:none; position:absolute; z-index:2} 
			#t_div { display:none; position:absolute; z-index:1} 
		'; ?>

	</style>
	<script type="text/javascript">	
		var calendar1 = new ekimo_calendar("f_show","f_date","Date From", "f_div");
		var calendar1 = new ekimo_calendar("t_show","t_date","Date To", "t_div");
	</script>
    	<h1><?php if ($this->_tpl_vars['blanketpo'] == 0): ?>View Orders<?php else: ?>Blanket Order<?php endif; ?></h1>
        <div class="blue">
        <div class="right">
        	<a href="javascript:void(0);" onclick="showsearch('search');">
			<img id="show_arrow" alt="Show Search" src="/app/default/www/images/arrow-down.png" border="0"/>
			</a>
		</div>
		<p class="left"><div style="display:none;" id="search">
			<table border="0" width="100%">
				<tr>
					<td width="10%">Country:</td>
					<td>
						<select name="search[country]">
								<option value="">--- Select Country ---</option>
							<?php $_from = $this->_tpl_vars['country']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
								<option value="<?php echo $this->_tpl_vars['item']['country_code']; ?>
"><?php echo $this->_tpl_vars['item']['country']; ?>
</option>
							<?php endforeach; endif; unset($_from); ?>
						</select>
					</td>
				</tr>
				<tr>
					<td>Supplier:</td>
					<td><select name="search[supplier]">
							<option value="">--- Select Supplier ---</option>
							<?php $_from = $this->_tpl_vars['supplier']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['suppitem']):
?>
								<option value="<?php echo $this->_tpl_vars['suppitem']['org_id']; ?>
"><?php echo $this->_tpl_vars['suppitem']['name']; ?>
</option>
							<?php endforeach; endif; unset($_from); ?>
					</select></td>
				</tr>
				<tr>
					<td>Date From:</td>
					<td>
						<label for="f_date">
							<input type="text" name="search[date_from]" id="f_date" readonly="true">
							<a href="javascript:void(0);" id="f_show"><img alt="Calendar" src="/app/default/www/images/calendar.jpg" border="0"/></a>
							<div id="f_div"></div>
						</label>
					</td>
				</tr>
				<tr>
					<td>Date To:</td>
					<td>
						<label for="t_date">
							<input type="text" name="search[date_to]" id="t_date" readonly="true">
							<a href="javascript:void(0);" id="t_show"><img alt="Calendar" src="/app/default/www/images/calendar.jpg" border="0"/></a>
							<div id="t_div"></div>
							&nbsp;&nbsp;
							<input type="button" value="Search" onclick="doajaxAction('/account/viewOrders/usersearch/1/blanketpo/<?php echo $this->_tpl_vars['blanketpo']; ?>
',1,'results',document.getElementById('mainForm'))">&nbsp;<input type="button" value="Save to Excel" onclick="doajaxAction('/account/savetoexcel/view/ors',0,'savetoexcel');popup('savetoexcel');"></td>
						</label>
				</tr>
			</table>
		</div></p>
        
        </div>
		<div class="white"></div>
<div class="blue" id="pagination">
	<table border=0 width="100%">
		<tr>
			<td align="center">
			<?php $this->assign('page', count($this->_tpl_vars['pagelist']['pagelength'])); ?>
			<?php $_from = $this->_tpl_vars['pagelist']['pagelength']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['data']):
?>
				<div id=<?php echo $this->_tpl_vars['key']; ?>
 <?php if ($this->_tpl_vars['key'] == 0): ?><?php else: ?>style="display:none"<?php endif; ?>>
				<?php if ($this->_tpl_vars['key'] > 0 && $this->_tpl_vars['page'] > 10): ?>&nbsp;<a href="javascript:void(0);" onclick="backpage(<?php echo $this->_tpl_vars['key']; ?>
)"> << </a><?php endif; ?>
				<?php $_from = $this->_tpl_vars['data']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
					<a href="javascript:void(0);"				onclick="doajaxAction('<?php echo $this->_tpl_vars['pagelist']['action']; ?>
/page/<?php echo $this->_tpl_vars['item']; ?>
',0,'results')"><?php echo $this->_tpl_vars['item']; ?>
</a>&nbsp;
				<?php endforeach; endif; unset($_from); ?>
				<?php if ($this->_tpl_vars['page'] > 10): ?>
				&nbsp;<a href="javascript:void(0);" onclick="forwardpage(<?php echo $this->_tpl_vars['key']; ?>
)"> >> </a>
				<?php endif; ?>
				</div>
				
			<?php endforeach; endif; unset($_from); ?>
			</td>
		</tr>
	</table>
</div>
<div class="white"></div>   
		<?php endif; ?>
           
            <div id="results">
				
                <!-- **************repeat here*************** -->
                
                <div>  
					<table width="100%">
						<tr>
							<td><strong>Date</strong></td>
							<td width="20%"><strong>PO NO</strong></td>
							<td align="center"><strong>Supplier</strong></td>
							<td align="center"><strong>Amount</strong></td>
							<td align="center"><strong>Status</strong></td>
						</tr>
						<tr><td colspan="5"><hr></td></tr>
						<?php $_from = $this->_tpl_vars['orders']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
						<tr class="<?php echo smarty_function_cycle(array('values' => "blue,notify"), $this);?>
">
							<td><?php echo $this->_tpl_vars['item']['date_order']; ?>
</td>
							<td><a href="javascript:void(0);" onclick="doajaxAction('/account/viewOrderDetails/poid/<?php echo $this->_tpl_vars['item']['po_id']; ?>
/supplier_org_id/<?php echo $this->_tpl_vars['item']['supplier_org_id']; ?>
',0,'main_content');"><?php echo $this->_tpl_vars['item']['po_no']; ?>
</a> <?php if ($this->_tpl_vars['item']['po_code']): ?> [Special Order]<?php endif; ?></td>
							<td><?php echo $this->_tpl_vars['item']['supplier']; ?>
</td>
							<td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['item']['totalAmount'])) ? $this->_run_mod_handler('number_format', true, $_tmp, '2%d') : number_format($_tmp, '2%d')); ?>
</td>
							<td align="center">
								<?php if ($this->_tpl_vars['item']['status'] == 'Open'): ?>
									<a href="javascript:void(0);" onclick="doajaxAction('/account/popupPayment/poid/<?php echo $this->_tpl_vars['item']['po_id']; ?>
/supplier_org_id/<?php echo $this->_tpl_vars['item']['supplier_org_id']; ?>
',0,'payment');popup('payment');"><?php echo $this->_tpl_vars['item']['status']; ?>
</a>
								<?php else: ?>
									<?php echo $this->_tpl_vars['item']['status']; ?>

								<?php endif; ?>
							</td>
						</tr>
						<?php endforeach; endif; unset($_from); ?>
					 </table>
            	</div>                
            </div>
</form>
<script language="javascript">
<?php echo '
		divid = document.getElementById(div);
		if(divid.style.display == \'none\') {
			divid.style.display = \'block\';
			document.getElementById(\'show_arrow\').src = "/app/default/www/images/arrow-up.png";
		} else {
			divid.style.display = \'none\';
			document.getElementById(\'show_arrow\').src = "/app/default/www/images/arrow-down.png";
		}
	}
'; ?>

</script>

            